package sk.tuke.magsa.tools.metamodel;

import java.util.Arrays;
import sk.tuke.magsa.tools.metamodel.ui.UI;
import yajco.annotation.Exclude;


public class Model {
    private final Entity[] entities;
    private Reference[] references;
    private UI ui;
 
    @Exclude
    public Model(Entity[] entities) {
        this.entities = entities;      
    }
    
    public Model(Entity[] entities, Reference[] references)
    {
        this.entities = entities;
        this.references = references;
    }

    public Entity[] getEntities() {
        return entities;
    }
    
    public Reference[] getReferences()
    {
        return this.references;
    }
    
    /**
     * @return the ui
     */
    public UI getUi() {
        return ui;
    }

    /**
     * @param ui the ui to set
     */
    public void setUi(UI ui) {
        this.ui = ui;
    }

    @Override
    public String toString() {
        return "model " + Arrays.toString(entities);
    }
    
    public Entity findEntity(String name)
    {
        Entity ent = null;
        for (Entity e : entities)
        {
            if(e.getName().equals(name))
            {
                ent = e;
                break;
            }
        }
        return ent;
    }

    
}
